package com.fhz.main.api

import androidx.lifecycle.LiveData
import com.fhz.common.entity.MeiNvEntity
import com.fhz.loginmvvm.callback.ApiResponse
import com.fhz.loginmvvm.callback.LiveDataCallAdapterFactory
import com.fhz.mvvm.api.YaoServiceApi
import com.fhz.mvvm.entity.UserEntity
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.GET
import retrofit2.http.Query

/**
 * 时间:2023/4/12
 * @author Mr.Feng
 * 简述:  每个包可以有自己的api
 */
interface MeiNvApi {

    companion object {

        fun create(): MeiNvApi {
            val logger = HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BASIC }

            val client = OkHttpClient.Builder()
                .addInterceptor(logger)
                .build()

            return Retrofit.Builder()
                .baseUrl(Cons.MEINV_HOST)
                .client(client)
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(LiveDataCallAdapterFactory())
                .build()
                .create(MeiNvApi::class.java)
        }
    }



    @GET("/api/getImages")
    fun getMeiNv(@Query("type") type:String,@Query("page") page:Int,@Query("size") size:Int) : LiveData<ApiResponse<MeiNvEntity>>

}